// 文件操作工具
export interface FileInfo {
  name: string
  path: string
  size: number
  type: string
  lastModified: Date
}

export class FileUtils {
  static async readFile(path: string): Promise<string> {
    // 简化的文件读取实现
    return ''
  }

  static async writeFile(path: string, content: string): Promise<void> {
    // 简化的文件写入实现
  }

  static async getFileInfo(path: string): Promise<FileInfo> {
    return {
      name: path.split('/').pop() || '',
      path,
      size: 0,
      type: 'text/plain',
      lastModified: new Date()
    }
  }

  static formatFileSize(bytes: number): string {
    if (bytes === 0) return '0 Bytes'
    const k = 1024
    const sizes = ['Bytes', 'KB', 'MB', 'GB']
    const i = Math.floor(Math.log(bytes) / Math.log(k))
    return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
  }
}

export default FileUtils